import Vue from 'vue'
import Search from '../views/MySearch.vue'
import Home from '../views/MyHome.vue'
import NotFound from '../views/NotFound.vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter) // 初始化

export default new VueRouter({
  // xxxxx/#/xxxx     hash路由 (默认方式)
  // xxxx/xxxx/xxxx   history路由 ,项目上线之后,需要服务器支持才能做到(webpack工程化打包 忽略了history)

  // mode: 'history',

  routes: [
    // redirect  重定向
    { path: '/', redirect: '/home' },
    { path: '/home', component: Home },
    // ?  可选值  ,保证能够正确的打开search.vue几十没有参数
    { path: '/search/:words?', component: Search },
    // 404 匹配
    { path: '*', component: NotFound }

  ],

})


